package com.qianya.system.manage.web.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qianya.system.manage.web.sys.model.SysSetAdminIp;
import com.qianya.system.manage.web.sys.service.ISysSetAdminIpService;
import com.qianya.system.manage.web.sys.mapper.SysSetAdminIpMapper;
import org.springframework.stereotype.Service;
import com.qianya.model.common.CommonResult;
import com.qianya.model.common.ResultCode;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
* <p>
*  后台ip访问限制服务实现类
* </p>
*
* @author lhl
* @since 2020-06-11
*/
@Service
public class SysSetAdminIpServiceImpl extends ServiceImpl<SysSetAdminIpMapper, SysSetAdminIp> implements ISysSetAdminIpService {


        /**
        * 修改 后台ip访问限制
        * @author lhl
        * @since 2020-06-11
        */
        @Override
        public CommonResult renewal(SysSetAdminIp sysSetAdminIp,HttpServletRequest request) {
            List<SysSetAdminIp> list=new ArrayList<SysSetAdminIp>();
            remove(new QueryWrapper<SysSetAdminIp>());
            boolean b =saveBatch(list);
            if (b){
                return CommonResult.success();
            }
            return CommonResult.error(ResultCode.ERROR,"操作失败");
        }


}
